package com.eway.viewanimator;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class RadarActivity extends AppCompatActivity implements View.OnClickListener {

	private ImageView imgOne, imgTwo, imgThree, imgFour;
	private Animation animationOne, animationTwo, animationThree, animationFour;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_radar);

		ImageView imgView = findViewById(R.id.radar_show);
		imgView.setOnClickListener(this);


		imgOne = findViewById(R.id.bg_one);
		imgTwo = findViewById(R.id.bg_two);
		imgThree = findViewById(R.id.bg_three);
		imgFour = findViewById(R.id.bg_four);

		animationOne = AnimationUtils.loadAnimation(RadarActivity.this, R.anim.radra_animation);
		animationTwo = AnimationUtils.loadAnimation(RadarActivity.this, R.anim.radra_animation);
		animationThree = AnimationUtils.loadAnimation(RadarActivity.this, R.anim.radra_animation);
		animationFour = AnimationUtils.loadAnimation(RadarActivity.this, R.anim.radra_animation);


	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.radar_show:
				imgOne.startAnimation(animationOne);

				animationTwo.setStartOffset(600);
				imgTwo.startAnimation(animationTwo);

				animationThree.setStartOffset(1200);
				imgThree.startAnimation(animationThree);

				animationFour.setStartOffset(1800);
				imgThree.startAnimation(animationFour);
				break;
		}
	}
}
